package com.ququ.syb.flow.controller;

import com.ququ.common.result.Result;
import com.ququ.common.result.ResultJson;
import com.ququ.syb.common.pojo.AccountBalanceFlow;
import com.ququ.syb.flow.service.AccountBalanceFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AccountBalanceFlowController {
    @Autowired
    private AccountBalanceFlowService accountBalanceFlowService;

    @RequestMapping("/list")
    public Result<List<AccountBalanceFlow>> listAccountBalanceFlow(@RequestParam String accountid,
                                                                   @RequestParam String tradenum,
                                                                   @RequestParam Long amount,
                                                                   @RequestParam Integer flowtype,
                                                                   @RequestParam String remark){
        return accountBalanceFlowService.listAccountBalanceFlow(accountid, tradenum, amount, flowtype,remark);
    }

    @RequestMapping("/save")
    public Result<AccountBalanceFlow> saveAccountBalanceFlow(@RequestParam String accountid,
                                                             @RequestParam String tradenum,
                                                             @RequestParam Long currentbalance,
                                                             @RequestParam Long amount,
                                                             @RequestParam Long afterbalance,
                                                             @RequestParam Integer flowtype,
                                                             @RequestParam String remark,
                                                             @RequestParam String appcode,
                                                             @RequestParam String paychannelid,
                                                             @RequestParam Integer ordertype){
        return accountBalanceFlowService.saveAccountBalanceFlow(accountid, tradenum, currentbalance, amount, afterbalance, flowtype, remark, appcode, paychannelid, ordertype);
    }

    @RequestMapping("/delete")
    public ResultJson deleteAccountBalanceFlow(@RequestParam String tradenum){
        return accountBalanceFlowService.deleteAccountBalanceFlow(tradenum);
    }
}
